package com.neusoft.tyut.deco;

public class BufferReader {
    private IReader reader;
    private byte[] buffer =  new byte[1024];
    private int  length = -1;
  private  String[] words =null;
  private int index = 0;
    public BufferReader(IReader reader)
    {
        this.reader = reader;
    }
    public String readline()
    {
        if (index >= words.length) {
            length = -1;
            return null;
        }
        if (length == -1){
            this.buffer =   this.reader.read();
            String s =  new String(buffer);
            words =  s.split("\r\n");
        }
        return  words[index++];
    }
    public static void main(String[] args)
    {
        BufferReader bufferReader = new BufferReader(new XmlFileReader());
        System.out.println(bufferReader.readline());
    }
}
